﻿@using CRM.Admin.Areas.Customer.Controllers
@using CRM.Admin.Contracts.Dto.Sys
@{
    ViewBag.Title = "营销地图";
}
@section head
{
    <link href="@Url.Content("~/ScriptPlugin/easyui/themes/gray/easyui.css")" rel="stylesheet" />
    <link href="@Url.Content("~/ScriptPlugin/easyui/themes/icon.css")" rel="stylesheet" />
    <script type="text/javascript" src="@Url.Content("~/ScriptPlugin/easyui/jquery.easyui.min.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/ScriptPlugin/easyui/locale/easyui-lang-zh_CN.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/KingsSharp.DataGrid.Filter.js")"></script>
    <script src="@Url.Content("~/ScriptPlugin/WdatePicker/js/WdatePicker.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/picdata.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/ScriptPlugin/webuploader/webuploader.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/KingsSharp.Uploader.js")"></script>
}
<div id="grid">
    <div id="toolpannel">
        <div class="content-pannel-buttons">
            <a><b class="p-icon-reload">刷新 </b></a>
            <a onclick="NetworkInfoEdit()"><b class="p-icon-edit">编辑</b></a>
            <a id="pickerB"><b class="p-icon-excle">导入Excel</b></a>
            <a onclick="$('#grid').datagrid('load')">
                <b class="p-icon-serch">查询</b>
            </a>
        </div>
        <div class="datagrid-filter-pannel" id="filterpannel">
            <table class="content-table-serch">
                <tr>
                    <th>
                        网点地区
                    </th>
                    <td>
                        <input type="text" name="NetworkArea" data-filter="true" style="width:150px"/>
                        <a class="p-icon-filter p-icon-filter-style" style="display: block; width: 22px;
                            height: 22px; float: left">@Html.GetFilterItem("NetworkArea", typeof(string))</a>
                        </td>
                    </tr>


                </table>
            </div>
        </div>
    </div>
    @section foot{
        <script type="text/javascript">
    function LoadCustmerInfoData()
    {
        var columns = [[
                        { field: "ck", checkbox: true },
                        { field: "NetworkArea", title: "网点地区", width: 90 },
                        { field: "NetworkName", title: "网点名称", width: 100 },
                        { field: "Profiles", title: "网点简介", width: 700 },
            ]];
            var parameter = {
            title: "@Html.GetGridTitle("营销地图","网点简介")",
            columns: columns,
            url: "@Url.Content("~/Customer/Marketing/NetWorkGridData")",
            pageNumber: 1
        };
        var grid = K.GetGridData("#grid", parameter).Grid;
    }
    LoadCustmerInfoData();
    K.PickeInit("datapicke");
    //导入功能
    var uploaderB = new K.Uploader().createExcle({
        swf: '@Url.Content("~/ScriptPlugin/webuploader/Uploader.swf")',
        server: '@Url.Content("~/Customer/Marketing/NetworkExcelInert")',
        pick: '#pickerB',
        resize: false,
        auto: true
    }, {
        uploadSuccess: function (file, response) {

            if (response.Filish) {

                K.Alert(response.Message);
            }
            $("#grid").datagrid("load");
        },
        uploadError: function () {
            K.Alert("上传出错");
        }
    });
            //编辑
            function NetworkInfoEdit() {
                var row = $("#grid").datagrid("getSelected");
                if (row == null) {
                    K.Alert("请选择需编辑的行");
                    return false;
                }
                K.layer.iframe({
                    title: "@Html.GetLayerTitle(LayerIcon.Edit,"编辑网点简介")",
                    content: "@Url.Content("~/Customer/Marketing/EditNetwork")?Id=" + row.Id,
                maxmin: true,
                initfull: true,
                btn: ["保存", "返回"],
                callback: function (result) {                   
                    if (K.ShowOrAlert(result)) {
                        $("#grid").datagrid("load");
                    }
                }
            });
            }
        </script>

    }